﻿using EPiServer;
using EPiServer.DynamicContent;
using SocialPack.modules.SocialPack.Widgets.Linkedin;

namespace SocialPack.modules.SocialPack.DynamicContent.Linkedin
{
    [DynamicContentPlugIn(
        DisplayName = "Linkedin Company Profile",
        Description = "Displays Linkedin Company Profile",
        ViewUrl = "~/modules/socialpack/dynamiccontent/linkedin/CompanyProfile.ascx")]
    public partial class CompanyProfile : UserControlBase
    {
        public string CompanyId { get; set; }

        public Format DisplayMode { get; set; }

        public string Text { get; set; }

        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!string.IsNullOrWhiteSpace(this.CompanyId))
            {
                this.CompanyProfileControl.CompanyId = this.CompanyId;
            }

            this.CompanyProfileControl.DisplayMode = this.DisplayMode;

            if (!string.IsNullOrWhiteSpace(this.Text))
            {
                this.CompanyProfileControl.Text = this.Text;
            }
        }
    }
}